home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group98b.txt
/
000112_icon-group-sender _Mon Jun 29 08:41:59 1998.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
3KB
Return-Path: <icon-group-sender>
Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id IAA06764
for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Mon, 29 Jun 1998 08:41:59 -0700 (MST)
Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
id AA00698; Mon, 29 Jun 1998 08:41:47 -0700
Sender: rwg@fns.com
Message-Id: <35970F72.40125E54@fns.com>
Date: Sun, 28 Jun 1998 23:52:18 -0400
From: Robbie Gilbert <rwg@fns.com>
Organization: Fujitsu Network Communications
X-Mailer: Mozilla 4.05 [en] (X11; I; SunOS 5.5.1 sun4u)
Mime-Version: 1.0
To: jeffery@segfault.cs.utsa.edu
Cc: Icon Mailing List <icon-group@optima.CS.Arizona.EDU>
Subject: Re: Forcing Generator to Return a List of Values
References: <199806290337.WAA12295@segfault.cs.utsa.edu>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 2116
Clint,
Thanks for the input! Yes, I've already discovered some coding problems and am
working on fixing them. This is only for a small (as you say, around 10) number
of iterations, so it shouldn't be too expensive in that sense, but being a newbie
I didn't realize co-expressions were memory-intensive.
I realized I was only saving one line of code but I hate to use a line of code for
something as trivial as initialization. Collecting all the values and assigning
them seems such a natural operation, especially if this is an operation that can
be reused. As you say, though, the performance hit may not justify the
succintness of the expression. I will do some timings and see.
Thanks again,
Robbie
rwg@fns.com
Clinton Jeffery wrote:
> [Robbie Gilbert provides a helper procedure and uses co-expression invocation
> p{} to solve his problem of turning a generator's result sequence into a list.]
>
> Hi Robbie,
>
> You've got some coding problems to fix, but when you fix them the general
> approach you describe will work and is attractively concise. However, it is
> not cheap. If you need to do this 10 times in your program, you have a
> great solution. If you need to do it many thousands of times, you had best
> not create a new co-expression every time you capture a generator's results.
> The reason is that each co-expression requires substantial memory for its
> own stack, and the memory for co-expressions is not allocated and reclaimed
> in the same, efficient way that most Icon values are.
>
> This is just my impression. I am a big co-expression advocate and would
> welcome corrections and anecdotes from persons who have happily used
> thousands of co-expressions in a single program!
>
> Remember, you are only going to save one line of code over:
> L := []
> every put(L, generator_expression)
>
> Perhaps if you do an experiment and collect some timings, that will influence
> you!
>
> Cheers,
>
> Clint Jeffery, jeffery@cs.utsa.edu
> Division of Computer Science, The University of Texas at San Antonio
> Research http://www.cs.utsa.edu/research/plss.html